#include <iostream>
#include <cstdio>
#include <stack>

using namespace std;

struct node {
    //s 溶质
    //ws 溶液
    double s, ws;
};

int main() {
    //ws0 初始(总的)溶液
    //c0 初始(总的)浓度
    double ws0, c0, s0;
    s0 = ws0 * c0 / 100;
    int n;
    cin >> n;
    stack<node> sta;
    for (int i = 0; i < n; ++i) {
        char t;
        cin >> t;
        if (t == 'P') {
            double wst, ct, st;
            cin >> wst >> ct;
            st = wst * ct / 100;
            ws0 += wst;
            s0 += st;
            sta.push((node){st, wst});
        } else {
            if (!sta.empty()) {
                ws0 -= sta.top().ws;
                s0 -= sta.top().s;
                sta.pop();
            }
        }
        printf("%d %.5lf\n", (int)ws0, s0 / ws0 * 100);
    }
    return 0;
}
